package com.example.qdindex.controller;

import com.example.qdindex.biz.KeHuBiz;
import org.example.bean.KeHuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/kehu")
public class KeHuController {
    @Autowired
    private KeHuBiz kub;
    @RequestMapping("/find")
    @ResponseBody
    public KeHuInfo findKeHeByMima(KeHuInfo khi, HttpSession session) {
        KeHuInfo kehu = kub.findKeHeByMima(khi);
            session.setAttribute("KEHU_DENGLU",kehu);
            return kehu;
    }
    @RequestMapping("/panduan")
    @ResponseBody
    public KeHuInfo panduan(HttpSession session) {
        return (KeHuInfo)session.getAttribute("KEHU_DENGLU");
    }
    @RequestMapping("/zhu")
    @ResponseBody
    public void zhu(HttpSession session) {
        session.removeAttribute("KEHU_DENGLU");
    }
}
